package com.imooc.handler;

import com.imooc.domain.Result;
import com.imooc.utils.ResultUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by ancy on 2017/7/8.
 */
@ControllerAdvice
public class ExceptionHandlers {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result handle( Exception ex) {
        return ResultUtil.error(500,ex.getMessage());
    }

}
